package com.ray.ba.code.generator;

import com.zaxxer.hikari.HikariDataSource;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.web.context.WebApplicationContext;

import javax.sql.DataSource;
import java.awt.*;
import java.net.URI;
import java.net.URISyntaxException;

/**
 * BaSecurityApplication
 *
 * @author ray
 * @date 2020/4/6
 */
@SpringBootApplication
public class BaCodeGeneratorApplication {

    public static void main(String[] args) throws Exception {
        SpringApplication.run(BaCodeGeneratorApplication.class,args);
    }

    @Bean
    @ConditionalOnMissingBean(DataSource.class)
    @Scope(value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.INTERFACES)
    DataSource dataSource(){
        return new HikariDataSource();
    }

}
